<template>
  <div>
    <el-tree :data="treeList" :props="treeProps" show-checkbox></el-tree>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { treeListApi } from "./api";

const treeProps = {
  // children属性是要告诉 tree 组件，在data里面哪个属性名是用来作用子级的
  children: "children",
  //   lable 是告诉 tree组件，在data里面哪个属性是用来显示文字的
  label: "title",
};

const treeList = ref<ItreeMenu[]>([]);

treeListApi().then((res) => {
  if (res.code === 200) {
    treeList.value = res.data;
  }
});
</script>

<style scoped></style>
